package global;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;

public class method_static {
	public final static int RandomBall(){
		Random r = new Random();
		int temp = r.nextInt(25);
		switch (temp) {
			case 12:
				return 1;
			case 2:
				return 2;
			case 22:
				return 3;
			case 9:
				return 4;
			default:
				return 0;
		}
	}
	public final static int SmallRandomBall(){
		Random r = new Random();
		return  r.nextInt(4)+1;
	}
	public final static int[][] RandomArrayBox(){
		int[][] tempArr = new int[JDefined.BOX_ROW][JDefined.BOX_COLUMN];
		for(int i = 0;i < JDefined.BOX_ROW;i++){
			for(int j=0;j<JDefined.BOX_COLUMN;j++){
				tempArr[i][j] = RandomBall();
			}
		}
		return tempArr;
	}
	public final static void fillBall(int x,int y, int color,Graphics g){
		switch (color) {
		case 1:
			g.setColor(Color.BLUE);
			g.fillOval(x, y, JDefined.BALL_WIDTH, JDefined.BALL_HEIGHT);
			break;
		case 2:
			g.setColor(Color.RED);
			g.fillOval(x, y, JDefined.BALL_WIDTH, JDefined.BALL_HEIGHT);
			break;
		case 3:
			g.setColor(Color.GREEN);
			g.fillOval(x, y, JDefined.BALL_WIDTH, JDefined.BALL_HEIGHT);
			break;
		case 4:
			g.setColor(Color.GRAY);
			g.fillOval(x, y, JDefined.BALL_WIDTH, JDefined.BALL_HEIGHT);
			break;
		default:
			break;
		}
	}
	public final static void addBall(int[][] arrBall){
		Random r = new Random();
		int n = 0;
		int temp;
		while(n<3){
			temp= r.nextInt(64);
			int row = temp/8;
			int column = temp%8;
			System.out.println(row + " " + column);
			if(arrBall[row][column] == 0){
				arrBall[row][column] = SmallRandomBall();
				n++;
			}
		}
	}
}
